package com.wc.alorithm_luogu.P5727;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/21 10:12
 * @description https://www.luogu.com.cn/problem/P5727
 * 冰雹猜想
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        StringBuffer ans = new StringBuffer();

        ans.append(n);

        while (n != 1) {
            if (n % 2 == 0) {
                n /= 2;
            } else {
                n = n * 3 + 1;
            }
            ans.insert(0, n + " ");
        }
        System.out.println(ans);
    }
}
